{if $smarty.session.pk_user} Hello
{$profile->name|default:$user->username|default:$user->email}!
<a href="{$REAL_ROOT}logout/user/">Logout</a>
<br />
<br />
{/if}

{if $smarty.session.p1_admin} Hello
{$admin->username|default:'admin'}!
<a href="{$REAL_ROOT}logout/admin/">Logout</a>
<br />
<br style="clear:both;" />
<a href="{$REAL_ROOT}admin/calculate/" style="padding:10px;border:1px solid #0cc;background:#fc1;font-weight:bold;">
Calculate Ranking Now!</a>
<br /><br />
<br style="clear:both;" />
{/if}

<h2>Ranking from {$last_update|date_format} to
{$next_update|date_format}.</h2>
<br />

<div style="height:600px;overflow:auto;">
	<table width="100%" border="0" cellspacing="0" cellpadding="0">
		<tr style="background: #ccc;">
			<th scope="row" style="padding: 10px;" width="50">&nbsp;</th>
			<td style="padding: 10px;"><b>Rank</b></td>
			<td style="padding: 10px;"><b>Event Name</b></td>
			<td style="padding: 10px;"><b>Votes</b></td>
			<td style="padding: 10px;"><b>Average Score</b></td>
			<td style="padding: 10px;"><b>Vote</b></td>
		</tr>
		{foreach from=$ranking item=_event name=events_rank key=_endix}
		<tr style="background: #{cycle values='none,dedede'};"
			onmouseover="tmp=this.style.background;this.style.background='#fff';"
			onmouseout="this.style.background=tmp;">
			<td valign="middle" style="vertical-align: middle; padding: 10px;">
			{if $_event->picture} <img src="{$_event->picture|picture}" alt=""
				width="45" height="45" vspace="center" /> {/if}</td>
			<td valign="middle"
				style="vertical-align: middle; text-align: center; padding: 10px;">{$smarty.foreach.events_rank.index+1}</td>
			<td valign="middle" style="vertical-align: middle;"><a
				href="{$REAL_ROOT}event/{$_event->name|seourl}/"> {$_event->name}</a>
			</td>
			<td valign="middle"
				style="vertical-align: middle; text-align: center;">{$_event->votes|default:'0'}</td>
			<td valign="middle"
				style="vertical-align: middle; text-align: center;">{$_event->avg}</td>
			<td valign="middle" style="vertical-align: middle;"><a rel="nofollow"
				href="{$REAL_ROOT}vote/{$_event->id|crc}/">Vote Now</a></td>
		</tr>
	
		{/foreach}
	</table>
</div>

